{% extends 'layout.html' %}


{% block content %}

    <h4>用户列表</h4>

        <div class="row" style="margin-top: 20px; margin-bottom: 20px">
        <div class="col-md-9">
{#            {% if per.add %}#}
{#            <btn class="btn btn-primary" id="add_userinfo">添加用户</btn>#}
{#            {% endif %}#}
        </div><!-- /.col-lg-6 -->

        <div class="col-md-3">
            <form>
                <div class="input-group">
                    {% if search_name %}
                        <input type="text" class="form-control" name="username" value="{{ search_name }}">
                    {% else %}
                        <input type="text" class="form-control" name="username" placeholder="模糊搜索用户名">
                    {% endif %}

                    <span class="input-group-btn">
                    <button class="btn btn-info" type="submit">搜索</button>
                  </span>
                </div><!-- /input-group -->
            </form>
        </div><!-- /.col-lg-6 -->
    </div><!-- /.row -->

    <table class="table table-bordered table-striped">
        <thead>
              <tr>
                   <th>序号</th>
                   <th>姓名</th>
                   <th>角色</th>
              </tr>
        </thead>
       <tbody>
            {% for user in user_list %}
            <tr>
                 <td>{{ forloop.counter }}</td>
                 <td>{{ user.displayName }}</td>
                 <td>
                     {% for role in user.roles.all %}
                     {{ role.title }}
                     {% endfor %}

                 </td>

{#                 <td>#}
{#                     {% if per.delete %}#}
{#                          <a href="/rbac/users/delete/{{ user.pk }}/" class="btn btn-danger">删除</a>#}
{#                     {% endif %}#}
{##}
{#                     {% if per.edit %}#}
{#                           <btn class="btn btn-warning edit_userinfo">编辑</btn>#}
{#                     {% endif %}#}
{##}
{#                 </td>#}
            </tr>
            {% endfor %}

       </tbody>
    </table>


{% endblock %}

{% block jss %}
    <script src="/static/rbac/users.js"></script>
{% endblock %}